import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err)
}

const routes = [
  {
    path: '/',
    name: '基础组件',
    icon: 'el-icon-s-order',
    redirect: '/more-wrap',
    component: () => import('@/views/base/index.vue'),
    children: [
      {
        path: 'more-wrap',
        name: '省略包裹层',
        icon: 'el-icon-s-order',
        component: () => import('@/views/more-wrap/index.vue')
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
